<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="node_modules/jquery/dist/jquery.js"></script>
    <style lang="">
        body {
            height: 2000px;
        }
        
        div {
            width: 100%;
            height: 100px;
            background: skyblue;
            position: fixed;
            top: 0;
            left: 0;
        }
    </style>
</head>

<body>
    <div></div>
</body>
<script>
    $(window).scroll(function() { //滚轮监听事件
        if ($(window).scrollTop() > 300) {
            $("div").fadeOut();
        } else {
            $("div").fadeIn();
        }
    })

    // 屏幕滚动时导航栏隐藏,屏幕停止滚动导航栏显示。
</script>

</html>